package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.DeviceData;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description DeviceDataMapper
 * @Author loe
 * @Date 2024-07-24
 */
@Mapper
public interface DeviceDataMapper {

    /**
     * 批量插入设备数据
     * @param list
     */
    void batchInsert(List<DeviceData> list);


    /**
     * 分页查询设备数据
     * @return
     */
    Page<DeviceData> pageSearch(String deviceName, LocalDateTime startTime, LocalDateTime endTime);

    /**
     * 按天统计查询指标数据
     * @param iotId
     * @param functionId
     * @param start
     * @param end
     * @return
     */
    List<DeviceDataGraphVo> queryDeviceDataListByDay(@Param("iotId") String iotId,
                                                     @Param("functionId") String functionId,
                                                     @Param("start") LocalDateTime start,
                                                     @Param("end") LocalDateTime end);

    /**
     * 按周统计查询指标数据
     * @param iotId
     * @param functionId
     * @param start
     * @param end
     * @return
     */
    List<DeviceDataGraphVo> queryDeviceDataListByWeek(@Param("iotId") String iotId,
                                                      @Param("functionId") String functionId,
                                                      @Param("start") LocalDateTime start,
                                                      @Param("end") LocalDateTime end);
}
